﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.Services.DataCache;
using Enter.Services.Mail;
using Enter.Mvc.Base.Controllers;
using System.Web.Mvc;
using Enter.Mvc.Mall.Model;

namespace Enter.Mvc.Mall.Controllers
{
    public class CollectionController : BaseControllers
    {
         private readonly ICache icache;
        private readonly IMail imail;

        public CollectionController(ICache cache, IMail mail)
        {
            this.icache = cache;
            this.imail = mail;
        }

        public ActionResult AddCollect(string shopNo,string gNo)
        {
             var results = new JsonResultModel();
            try
            {
                if (imail.AddGoodCollect(7, shopNo, gNo))
                {
                    results.ResultCode = "00";
                    results.ResultMsg = "收藏成功";
                }
                else {
                    results.ResultCode = "01";
                    results.ResultMsg = "收藏失败";
                }
            }
            catch (Exception ex)
            {

                results.ResultCode = "01";
                results.ResultMsg = ex.Message;
            }
            return Json(results);
        }
    }
}
